package cn.com.css.taxInspection.gt3.service.impl;

import cn.com.css.taxInspection.gt3.entity.JcDsrwLogEntity;
import cn.com.css.taxInspection.gt3.mapper.JcDsrwLogMapper;
import cn.com.css.taxInspection.gt3.service.JcDsrwLogService;
import cn.com.css.taxInspection.util.TsBqUtils;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class JcDsrwLogServiceImpl extends ServiceImpl<JcDsrwLogMapper, JcDsrwLogEntity> implements JcDsrwLogService {

    @Override
    public IPage<JcDsrwLogEntity> queryXtrwList(JcDsrwLogEntity jcDsrwLogEntity) {
        IPage<JcDsrwLogEntity> page = new Page<>(jcDsrwLogEntity.getPage(), jcDsrwLogEntity.getLimit());
        LambdaQueryWrapper<JcDsrwLogEntity> queryWrapper = Wrappers.lambdaQuery();
        // 定时任务ID
        if (TsBqUtils.isNotNull(jcDsrwLogEntity.getDsrwid())) {
            queryWrapper.like(JcDsrwLogEntity::getDsrwid, jcDsrwLogEntity.getDsrwid());
        }
        // 定时任务名称
        if (TsBqUtils.isNotNull(jcDsrwLogEntity.getDsrwmc())) {
            queryWrapper.like(JcDsrwLogEntity::getDsrwmc, jcDsrwLogEntity.getDsrwmc());
        }
        queryWrapper.orderByDesc(JcDsrwLogEntity::getZxsj);
        return page(page, queryWrapper);
    }
}